﻿<%@ Page Title="Cadastro Cliente" Language="vb" AutoEventWireup="false" MasterPageFile="~/adm/Pagina.Master"
    CodeBehind="CadastroCliente.aspx.vb" EnableEventValidation="false" Async="true"
    Inherits="sonicERPinterface.CadastroCliente" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <script language="javascript" type="text/javascript">
        $(document).ready(function () {
            var ltbtelefone = $('[id$=ltbtelefone]');
            var ddltipotelefone = "*[id$='ddltipotelefone']";
            var tc = $(ddltipotelefone);
            var txttelefone = "*[id$='txttelefone']";
            var tele = $(txttelefone);
            var imgtelefone = "*[id$='imgtelefone']";
            var img = $(imgtelefone);
            var chkIs = "*[id$='chkIs']";
            var ch = $(chkIs);
            var txtIS = "*[id$='txtIS']";
            var txis = $(txtIS);
            $(img).click(function () {
                if (tc[0].selectedIndex == 0) {
                    alert("Selecione o Tipo de Telefone")
                    tc.focus();
                    return false;
                }
                else if (tele.val() == "") {
                    alert("Digite o Telefone")
                    telefone.focus();
                    return false;
                }


            });

            $(ltbtelefone).dblclick(function () {

                RemoverTel();
            });

            $(ltbtelefone).keypress(function (i) {

                if (i.keyCode == 46) {
                    RemoverTel();
                }

            });
        });
      
    </script>
    <div id="divcadastro">
        <asp:Panel runat="server">
            <table>
                <tr>
                    <td>
                        <asp:ImageButton ImageUrl="~/img/sub_blue_rotate_ccw.png" runat="server" OnClick="Unnamed2_Click" />
                    </td>
                </tr>
                <tr>
                    <td>
                        Voltar Para Lista
                    </td>
                </tr>
            </table>
        </asp:Panel>
        <br />
        <asp:Panel ID="pnlerro" BorderStyle="Ridge" CssClass="PanelNone" runat="server">
            <center>
                <table border="1">
                    <tr>
                        <td>
                            <asp:Label ID="lblerro" ForeColor="Red" Font-Size="X-Large" runat="server"></asp:Label>
                        </td>
                    </tr>
                </table>
            </center>
        </asp:Panel>
        <br />
        <asp:Panel ID="pnlTipocliente" BorderStyle="Ridge" runat="server">
            <center>
                <label>
                    Tipo Do Cliente
                </label>
            </center>
            <br />
            <center>
                <asp:RadioButtonList ID="rdbtipocliente" runat="server" AutoPostBack="True">
                </asp:RadioButtonList>
            </center>
        </asp:Panel>
        <br />
        <asp:Panel ID="pnlnomeCliente" Visible="false" BorderStyle="Ridge" runat="server">
            <center>
                <label>
                    Informações do Cliente
                </label>
            </center>
            <br />
            <table border="1" cellpadding="5" style="width: 917px">
                <tr>
                    <td>
                        Nome:
                    </td>
                    <td>
                        <asp:TextBox ID="txtCliente" runat="server" Width="275px"></asp:TextBox>
                    </td>
                    <td>
                        Email:
                    </td>
                    <td>
                        <asp:TextBox ID="txtemail" runat="server" Width="264px"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td>
                        Contato:
                    </td>
                    <td colspan="4">
                        <asp:TextBox ID="txtContato" runat="server" Width="264px"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td>
                        <label>
                            Tipo de Telefone:
                        </label>
                    </td>
                    <td colspan="5">
                        <asp:DropDownList ID="ddltipotelefone" ToolTip="Dois Click para Remover o Telefone"
                            runat="server" Width="185px">
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td>
                        <label>
                            Telefone:
                        </label>
                    </td>
                    <td>
                        <asp:TextBox ID="txttelefone" onkeyup="formataTelefone(this,event);" runat="server"
                            Width="209px" MaxLength="15"></asp:TextBox>
                    </td>
                    <td colspan="4">
                        <asp:ImageButton ID="imgtelefone" ImageUrl="~/img/sub_blue_accept.png" ToolTip="Add Telefone"
                            OnClientClick="PopularTel(); return false;" runat="server" />
                    </td>
                </tr>
                <tr>
                    <td align="left" colspan="2">
                        <asp:ListBox ID="ltbtelefone" SelectionMode="Multiple" runat="server" Width="440px">
                        </asp:ListBox>
                    </td>
                    <td colspan="4">
                        <asp:ImageButton ID="imgRemoverTelefone" ImageUrl="~/img/sub_blue_delete.png" ToolTip="Remover Telefone"
                            OnClientClick="RemoverTel(); return false;" runat="server" />
                    </td>
                </tr>
            </table>
        </asp:Panel>
        <br />
        <asp:Panel ID="pnllogradouro" Visible="false" BorderStyle="Ridge" runat="server">
            <center>
                <label>
                    Endereço
                </label>
            </center>
            <table border="2" cellpadding="5" cellspacing="2">
                <tr>
                    <td>
                        Cep:
                    </td>
                    <td style="margin-left: 80px">
                        <asp:TextBox ID="txtCep" onkeyup="formataCEP(this,event);" runat="server" Width="194px">
                        </asp:TextBox>
                    </td>
                    <td>
                        <asp:ImageButton ID="imgcep" ImageUrl="~/img/sub_blue_accept.png" ToolTip="Buscar Cep"
                            runat="server" />
                    </td>
                    <td>
                        Logradouro:
                    </td>
                    <td>
                        <asp:TextBox ID="txtLogradouro" Enabled="false" runat="server" Width="247px">
                        </asp:TextBox>
                    </td>
                    <td>
                        Nº:
                    </td>
                    <td>
                        <asp:TextBox ID="txtnumero" onkeyup="formataInteiro(this,event);" runat="server">
                        </asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td>
                        Estado:
                    </td>
                    <td colspan="2">
                        <asp:TextBox ID="txtEstado" Enabled="false" runat="server">
                        </asp:TextBox>
                    </td>
                    <td>
                        Cidade:
                    </td>
                    <td>
                        <asp:TextBox ID="txtCidade" Enabled="false" runat="server">
                        </asp:TextBox>
                    </td>
                    <td>
                        Bairro:
                    </td>
                    <td>
                        <asp:TextBox ID="txtBairro" Enabled="false" runat="server">
                        </asp:TextBox>
                    </td>
                </tr>
            </table>
            <center>
                <span id="MsgAguarde" style="display: none; font-size: 11px;">
                    <img src="../img/ajax-loader.gif" alt="Aguarde.." /><br />
                    Aguarde... </span>
            </center>
        </asp:Panel>
        <br />
        <asp:Panel ID="pnlJuridica" Visible="false" BorderStyle="Ridge" runat="server">
            <center>
                <label>
                    Informações Cliente Juridico
                </label>
            </center>
            <table border="2" cellpadding="5" cellspacing="2">
                <tr>
                    <td>
                        <asp:CheckBox ID="chkIs" Text="Inscrição Estadual e Inseto ?" AutoPostBack="true"
                            runat="server" />
                    </td>
                </tr>
                <tr>
                    <td>
                        Inscricão Estadual:
                    </td>
                    <td>
                        <asp:TextBox ID="txtIS" onkeyup="formataInscricaoestadual(this,event);" runat="server"
                            Width="272px">
                        </asp:TextBox>
                    </td>
                    <td>
                        CNPJ:
                    </td>
                    <td>
                        <asp:TextBox ID="txtCNPJ" runat="server" onkeyup="formataCNPJ(this,event);" MaxLength="18"
                            Width="317px">
                        </asp:TextBox>
                    </td>
                </tr>
            </table>
        </asp:Panel>
        <br />
        <asp:Panel ID="pnlFisica" Visible="false" BorderStyle="Ridge" runat="server">
            <center>
                <label>
                    Informações Cliente Fisico
                </label>
            </center>
            <table border="2" cellpadding="5" cellspacing="2">
                <tr>
                    <td>
                        Rg:
                    </td>
                    <td>
                        <asp:TextBox ID="txtRg" runat="server" Width="272px">
                        </asp:TextBox>
                    </td>
                    <td>
                        CPF:
                    </td>
                    <td>
                        <asp:TextBox ID="txtCPF" onkeyup="formataCPF(this,event);" MaxLength="14" runat="server"
                            Width="317px">
                        </asp:TextBox>
                    </td>
                </tr>
            </table>
        </asp:Panel>
        <br />
        <asp:Panel ID="pnlbotao" runat="server">
            <center>
                <table cellpadding="10">
                    <tr>
                        <td>
                            <asp:ImageButton ID="imgGravar" ImageUrl="~/img/comment_accept.png" runat="server" />
                        </td>
                        <td>
                            <asp:ImageButton ID="imgExcluir" ImageUrl="~/img/comment_delete.png" runat="server" />
                        </td>
                        <td>
                            <asp:ImageButton ID="ImageButton1" ImageUrl="~/img/comment_add.png" runat="server" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Gravar
                        </td>
                        <td>
                            Excluir
                        </td>
                        <td>
                            Novo
                        </td>
                    </tr>
                </table>
            </center>
        </asp:Panel>
    </div>
</asp:Content>
